/**
 * @资源路由
 * api.get('/index', IndexController.index)
 * api.get('/index/create', IndexController.create)
 * api.post('/index', IndexController.store)
 * api.get('/index/:id', IndexController.show)
 * api.get('/index/:id/edit', IndexController.edit)
 * api.put('/index/:id', IndexController.save)
 * api.get('/index/:id/edit', IndexController.destroy)
 * 
 */
class Base_Router {
    constructor() {
    
    }
    async resource (name, controller) {
        this.$api.get(`/${name}`, controller.index)
        this.$api.get(`/${name}/create`,  controller.create)
        this.$api.post(`/${name}`,  controller.store)
        this.$api.get(`/${name}/:id`,  controller.show)
        this.$api.get(`/${name}/:id/edit`,  controller.edit)
        this.$api.put(`/${name}/:id`,  controller.save)
        this.$api.get(`/${name}/:id/edit`,  controller.destroy)
    }
}

module.exports = Base_Router
